using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace UglyAnimals
{
    class Player
    {
        public enum AnimalIndex
        {
            NakedMole,
            Seacow,
            Turkey
        };

        public List<Animal> Animals
        {
            get;
            set;
        }

        // The Current Animal of the Player.
        public Animal PlayerAnimal
        {
            set;
            get;
        }

        // Position of the Player relative to the upper left side of the screen 
        public Vector2 Position
        {
            get
            {
                return PlayerAnimal.Position;
            }

            set
            {
                PlayerAnimal.Position = value;
            }
        }


        // State of the player
        public bool Active;

        // The player score
        public int Score;

        // Get the width of the player      
        public int Width
        {
            get
            {
                return PlayerAnimal.Width;
            }
        }

        // Get the height of the player 
        public int Height
        {
            get
            {
                return PlayerAnimal.Height;
            }
        }


        public void Initialize(List<Animal> animals)
        {
            Animals = animals;
            PlayerAnimal = Animals.ElementAt((int)AnimalIndex.NakedMole);

            // Set the player to be active 
            Active = true;
            Score = 0;
        }

        public void Update(GameTime gameTime)
        {
            if(Active)
            PlayerAnimal.Update(gameTime);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            if(Active)
            PlayerAnimal.Draw(spriteBatch);
        }
    }
}
